﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GameProtocol;
using LOLServer.Biz;
using LOLServer.Biz.User.Interface;
using NetFrame;
using NetFrame.Auto;

namespace LOLServer.Logic.User
{
    /*账Account只负责登录注册
     * User只负责召唤师信息
     * Hero表示使用的英雄
     */
    public class UserHandler : AbsHandlerBase, HandlerInterface
    {
        private IUserBiz mUB = BizFactory.mUserBiz; 
        public void ClientClose(UserToken token, string error)
        {
        }

        public void ClientConnect(UserToken token)
        {
        }
        /// <summary>
        /// 创建用户
        /// </summary>
        /// <param name="token"></param>
        /// <param name="_name"></param>
        void CreateUser(UserToken token,string _name)
        {
            
        }
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <param name="token"></param>
        void Info(UserToken token)
        {
             
        }
        /// <summary>
        /// 角色是否在线
        /// </summary>
        /// <param name="token"></param>
        void OnLine(UserToken token)
        {
            
        }
        public void MessageReceive(UserToken token, SocketModel message)
        {
            switch (message.Command)
            {
                case UserProtocol.INFO_CREQ:
                    Info(token);
                    break;
                case UserProtocol.CREATE_USER_CREQ:
                    CreateUser(token,message.GetMessage<string>());
                    break;
                case UserProtocol.ONLINE_USER_CREQ:
                    OnLine(token);
                    break;
            }
        }

        public override byte GetGameType()
        {
            return Protocol.TYPE_USER;
        }
    }
}
